#ifndef VOXEL_H
#define VOXEL_H
#include "includes.h"
#include "vbovoxel.h"

class voxel
{
    colour col;
    char face;
    //uchar x,y,z;
    //vboVoxel vvv;
    //void setWorldCoords(uchar,uchar,uchar);
public:
    voxel();
    ~voxel();
    bool draw();
    bool drawTop();
    bool drawBottom();
    bool drawLeft();
    bool drawRight();
    bool drawFront();
    bool drawBack();
    bool drawFaces();

    void setDraw(bool);
    void setDrawTop(bool);
    void setDrawBottom(bool);
    void setDrawLeft(bool);
    void setDrawRight(bool);
    void setDrawFront(bool);
    void setDrawBack(bool);
    void setFace(char f);

    void setColor(float r, float g, float b);
    void setColor(colour c);
    colour& getColor();

    int worldX();
    int worldY();
    int worldZ();


    friend class Chunk;
};


/*
inline
void voxel::setWorldCoords(uchar _x, uchar _y,uchar _z){
    x=_x;
    y=_y;
    z=_z;
}

inline
int voxel::worldX(){
    return x;
}

inline
int voxel::worldY(){
    return y;
}

inline
int voxel::worldZ(){
    return z;
}

*/

inline
bool voxel::draw(){
return face&DRAW;
}

inline
bool voxel::drawTop(){
   return face&TOP;
}

inline
bool voxel::drawBottom(){
    return face&BOTTOM;
}

inline
bool voxel::drawLeft(){
    return face&LEFT;
}

inline
bool voxel::drawRight(){
    return face&RIGHT;
}

inline
bool voxel::drawFront(){
    return face&FRONT;
}

inline
bool voxel::drawBack(){
    return face&BACK;
}

inline
bool voxel::drawFaces(){
    return face&(DRAW-1);
}

inline
void voxel::setDraw(bool yes){
    if(yes)face|=DRAW;
    else face &=(~DRAW);
}

inline
void voxel::setDrawTop(bool yes){
    if(yes)face|=TOP;
    else face &=(~TOP);
}

inline
void voxel::setDrawBottom(bool yes){
    if(yes)face|=BOTTOM;
    else face &=(~BOTTOM);
}

inline
void voxel::setDrawLeft(bool yes){
    if(yes)face|=LEFT;
    else face &=(~LEFT);
}

inline
void voxel::setDrawRight(bool yes){
    if(yes)face|=RIGHT;
    else face &=(~RIGHT);
}

inline
void voxel::setDrawFront(bool yes){
    if(yes)face|=FRONT;
    else face &=(~FRONT);
}

inline
void voxel::setDrawBack(bool yes){
    if(yes)face|=BACK;
    else face &=(~BACK);
}

inline
void voxel::setFace(char f){
    face=f;
}

inline
void voxel::setColor(float r, float g, float b){
    col.r=r;
    col.g=g;
    col.b=b;
}

inline
void voxel::setColor(colour c){
    col=c;
}

inline
colour& voxel::getColor(){
    return col;
}


#endif // VOXEL_H
